package org.example;

public class App {
    public static void main(String[] args) {
        Thread thread = new Thread() {
            @Override
            public void run() {
//                System.out.println(Thread.currentThread());
//                System.out.println(this);
//                System.out.println(System.identityHashCode(this));
//                System.out.println(System.identityHashCode(Thread.currentThread()));


                interrupt();
                try {
                    System.out.println("--------sleep----1111-----");
                    Thread.sleep(5000);
                    System.out.println("--------sleep----2222-----");
                } catch (Throwable e) {
                    System.out.println("--------InterruptedException----1111-----");
//                    throw new RuntimeException(e);
                }

                System.out.println("--------InterruptedException----2222-----");
            }

            @Override
            public void interrupt() {
                System.out.println(Thread.currentThread());
                System.out.println(this);
                System.out.println(System.identityHashCode(this));
                System.out.println(System.identityHashCode(Thread.currentThread()));
                System.out.println("--------interrupt----开始-----");
                super.interrupt();
//                try {
//                    Thread.sleep(1);
//                } catch (InterruptedException e) {
//                    throw new RuntimeException(e);
//                }
                System.out.println("--------interrupt----结束-----");
            }
        };

        thread.start();
//        thread.run();


    }
}

